package cn.buk.tms.dto;

import cn.buk.common.util.DecimalUtil;
import cn.buk.tms.entity.misc.PaymentMethod;
import cn.buk.tms.entity.misc.Supplier;
import cn.buk.tms.common.dto.PaymentMethodDto;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.util.Date;

/**
 * 用于报表的火车票账单内容
 * @author william
 *
 */
public class ReportTrainDto extends ReportBaseDto {

	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
	private Date opDate;

    private String trainNo;
    private String dcity;
    private String acity;

	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date ddate;

	private String seatClass;

    private double total;
    private double cost;
    private double profit;

    public ReportTrainDto(String trainNo, String dcity, String acity, Date ddate, String seatClass, double total, double cost, double profit,
                          Date opDate, String op1, String op2, String op3,
                          Integer customerType, Integer customerId, int billId, Supplier supplier, PaymentMethod pm) {
		super(op1, op2, op3, customerType, customerId);

        this.trainNo = trainNo;
        this.dcity = dcity;
        this.acity = acity;

        this.ddate = ddate;
        this.seatClass = seatClass;

        this.total = total;
        this.cost = cost;
        this.profit = profit;

        this.opDate = opDate;

        this.supplier = SupplierDto.createBySupplier(supplier);
        this.paymentMethod = PaymentMethodDto.create(pm.getId(), pm.getName());

        this.billId = billId;
    }

	private int billId;

    /**
     * 供应商
     */
	private SupplierDto supplier;

    /**
     * 出票付款方式
     */
	private PaymentMethodDto paymentMethod;


	public double getProfit() {
		return DecimalUtil.keepScale2(profit);
	}

	public void setProfit(double profit) {
		this.profit = profit;
	}


    public SupplierDto getSupplier() {
        return supplier;
    }

    public void setSupplier(SupplierDto supplier) {
        this.supplier = supplier;
    }

    public PaymentMethodDto getPaymentMethod() {
        return paymentMethod;
    }

    public void setPaymentMethod(PaymentMethodDto paymentMethod) {
        this.paymentMethod = paymentMethod;
    }

	public int getBillId() {
		return billId;
	}

	public void setBillId(int billId) {
		this.billId = billId;
	}

	public Date getOpDate() {
		return opDate;
	}

    public double getTotal() {
        return total;
    }

    public double getCost() {
        return cost;
    }

	public String getTrainNo() {
		return trainNo;
	}

	public void setTrainNo(String trainNo) {
		this.trainNo = trainNo;
	}

	public String getDcity() {
		return dcity;
	}

	public void setDcity(String dcity) {
		this.dcity = dcity;
	}

	public String getAcity() {
		return acity;
	}

	public void setAcity(String acity) {
		this.acity = acity;
	}

	public Date getDdate() {
		return ddate;
	}

	public String getSeatClass() {
		return seatClass;
	}
}
